<template>
  <div>
    <div>08$refs与$parent</div>
    <div>
      老爹的房产证数量：{{ house }} <button @click="addBook($refs)">增加寒假作业</button>
    </div>
    <son1 ref="n1" />
    <son2 ref="n2" />
  </div>
</template>

<script lang="ts" setup>
import { reactive, ref } from 'vue'
import son1 from './son1.vue'
import son2 from './son2.vue'

let n1 = ref()
let n2 = ref()
let obj = reactive({ name: "张三" })
// $refs与$parent，本质都是reactive对象
function addBook(refs: {[key: string]: any}) {
  for (const key in refs) {
    refs[key].book += 1
  }
}

let house = ref(5)

defineExpose({ house })
</script>

<style lang="scss" scoped>

</style>